package telepasea.app;

import java.util.ArrayList;

import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.provider.ContactsContract.PhoneLookup;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class SettingUI extends Activity {
	/** Called when the activity is first created. */
	ArrayList<String> Items;

	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.setting);

		Items = new ArrayList<String>();
		Items.add("My Profile");
		Items.add("Notification Setting");
		Items.add("Synchronize AddressBook");

		ListView listSettings = (ListView) findViewById(R.id.listView2);
		ArrayAdapter<String> adapterSettings;
		adapterSettings = new ArrayAdapter<String>(this,
				android.R.layout.simple_list_item_1, Items);
		listSettings.setAdapter(adapterSettings);

		listSettings.setOnItemClickListener(mItemClickListener);
	}

	AdapterView.OnItemClickListener mItemClickListener = new AdapterView.OnItemClickListener() {
		public void onItemClick(AdapterView parent, View view, int position, long id) {
			if (parent.getItemAtPosition(position).equals("My Profile")) {
				startActivity(new Intent(SettingUI.this, ProfileUI.class));
			}
			else if (parent.getItemAtPosition(position).equals("Notification Setting")) {
				startActivity(new Intent(SettingUI.this, PushFilterUI.class));
			}
			else if (parent.getItemAtPosition(position).equals("Synchronize Addressbook")) {
				TelepaSEAActivity.cm.synchronize();
			}
		}
	};
}